/*
    LEDCube Library
    Author: David Hurst
    Date: 4/20/2012

    layerNum is defined from 0 to 7
    XYZ coordinates range from 0 to 7 each.

    Use this code wisely
*/

#ifndef LEDCube_h
#define LEDCube_h

#include <inttypes.h>

class LEDCube {

  public:
    //Constructor that specifies which pins are what
    LEDCube(int data, int clock, int latch, int layer1, int layer2, int layer3, int layer4, int layer5, int layer6, int layer7, int layer8, int enablePin);
    //Manually set a layer data, not for the weak
    void setLayerData(uint16_t data, uint8_t layerNum, uint8_t chip);
    //turns and xyz coordinate on
    void setXYZ(uint8_t x, uint8_t y, uint8_t z);
    //clears all the layers (frame buffer really)
    void clearAllLayers();
    //clear a single layer (everything on the z plane)
    void clearLayer(int layerNum);
    //shift out data to led cube
    void shiftOutAll(int layerDelay);
    //enables a single layer
    void enableLayer(int layerNum);
    //disables all layers
    void disableLayers();

    private:
    //frame buffer: 8 layers of 4 16 bit numbers
    volatile uint16_t layerData [8][4];
    //Pins for sending data
    int m_dataPin;
    int m_clockPin;
    int m_latchPin;
    int m_enablePin;
    int layerPins [8];
    //shifts out 64 bits
    void shiftOut64(uint8_t layer);

};

#endif

